@use "@aquascope/editor/dist/styles.scss";
@import "normalize.css/normalize.css";
@import "font-awesome/css/font-awesome.css";

$monospace: "Source Code Pro", monospace;
$color-lightest: white;
$color-light: #f5f5f5;
$color-dark: #e8e8e8;
$color-darkest: #ddd;
$color-bg: rgb(250, 250, 250);
$color-error: #cc0000;
$color-warn: #a88905;

// Override some of the variables defined in the editor stylesheet
:root {
  --aq-button-border: #e8e8e8;
  --aq-button-text: black;
  --aq-button-background: #f5f5f5;
  --aq-button-border-hover: #e8e8e8;
  --aq-button-text-hover: black;
  --aq-button-background-hover: #e8e8e8;
}

@mixin with-border {
  border-style: solid;
  border-width: 5px;
  border-radius: 5px;
  border-color: $color-dark;
}

@mixin shaded-and-outlined {
  @include with-border;
  background-color: $color-light;
}

html,
body {
  font: 18px "Helvetica Neue", "Open Sans", Arial, sans-serif;  
  background-color: $color-bg;
}

body {
  padding: 1em;
}

h1 {
  margin-top: 0;
  font-weight: bold;
}

p {
  max-width: 600px;
}

.blurb {
  @include shaded-and-outlined;
  width: 50%;
  display: inline-block;
  margin: auto;
  padding: 5px;
  margin-bottom: 4em;
}

// nav {
//   width: 100%;
//   background-color: $color-bg;
//   padding-left: 30px;
//   padding-right: 10px;
// }

// .nav-item {
//   display: inline-block;
//   padding: 10px 15px;
//   font-weight: bold;
//   color: $color-lightest;
// }

// .nav-item:hover {
//   color: $color-light;
// }

.buttons {
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 0.25em;
  // width: 200px;

  .cm-button {
    @include shaded-and-outlined;
    border-width: 3px;
    padding: 5px 10px;
    display: inline-block;
    cursor: pointer;
    
    &:hover {
      background-color: $color-dark;
    }

    .loader {    
      @keyframes rotation {
        0% {
            transform: rotate(0deg);
        }
        100% {
            transform: rotate(360deg);
        }
      } 

      width: 16px;
      height: 16px;
      border: 3px solid #aaa;
      border-bottom-color: transparent;
      border-radius: 50%;
      box-sizing: border-box;
      animation: rotation 1s linear infinite;      
      display: none;
      position: relative;
      margin-left: 5px;
      top: 2px;
    }

    &.waiting {
      .loader {
        display: inline-block;
      }
    }
  }

  .dropdown {
    display: inline-block;

    &:hover {
      background-color: $color-dark;
    }
  }
}

.dropdown-content {
  display: none;
  padding: 12px 6px;
  position: absolute;
  background-color: $color-light;
  min-width: 160px;
  z-index: 1;
}

.dropdown-content label {
  color: black;
  text-decoration: none;
  display: block;
  font-size: 0.8em;
}

.dropdown-content a:hover {
  background-color: $color-darkest;
}

.dropdown:hover .dropdown-content {
  display: block;
}

a:hover {
  opacity: 0.5;
}

/* The container for a custom checkbox */
.dropdown-container {
  display: block;
  position: relative;
  padding-left: 35px;
  margin-bottom: 12px;
  cursor: pointer;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Hide the browser's default checkbox */
.dropdown-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

/* Create a custom checkbox */
.checkmark {
  position: absolute;
  top: 0;
  left: 0;
  height: 22px;
  width: 22px;
  background-color: $color-dark;
}

.dropdown-container:hover input ~ .checkmark {
  background-color: $color-darkest;
}

.dropdown-container input:checked ~ .checkmark {
  background-color: $color-darkest;
}

.checkmark:after {
  content: "";
  position: absolute;
  display: none;
}

.dropdown-container input:checked ~ .checkmark:after {
  display: block;
}

.dropdown-container .checkmark:after {
  left: 9px;
  top: 5px;
  width: 5px;
  height: 10px;
  border: solid $color-lightest;
  border-width: 0 3px 3px 0;
  -webkit-transform: rotate(45deg);
  -ms-transform: rotate(45deg);
  transform: rotate(45deg);
}

.analysis-error-card {
  @include shaded-and-outlined;
  border-color: $color-error;
  z-index: 6;
  min-width: 25%;
  max-width: 50%;

  font-size: 0.8em;
  padding: 1em;
  visibility: hidden;

  // trying to center it in the screen ...
  position: fixed;
  top: 50%;
  transform: translateY(-50%);

  > h3 {
    font-size: 1.4em;
    font-weight: 800;
  }

  & a {
    text-decoration: underline 2px $color-darkest;
  }

  &.live {
    visibility: visible !important;
  }

  & .analysis-error-msg {
    background-color: $color-lightest;
    overflow: scroll;
    font-family: monospace;
  }
}

.build-error-card {
  @include with-border;

  border-color: $color-darkest;
  background-color: $color-warn;
  color: white;
  font-style: bold;

  z-index: 5;

  position: fixed;
  top: 50%;
  right: 10%;

  max-width: 250px;
  display: inline-block;
  font-size: 0.8em;
  padding: 1em;
  visibility: hidden;
  transition: all 0.5s ease;

  > h3 {
    font-size: 1.4em;
    font-weight: 800;
  }

  &.live {
    visibility: visible !important;
  }
}

#close {
  float: right;
  display: inline-block;
  padding: 2px 5px;
  background: $color-dark;
}

#close:hover {
  cursor: pointer;
  background: $color-darkest;
  color: black;
}

.aquascope-stderr {
  overflow-x: auto;
}

/* XXX: tabs **************************************** */

.columns {
  display: flex;
  width: max-content; 
  margin-top: 2em;
  gap: 10px;
}

.tabs-container {  
  width: 750px;  
}

.tabs {
  list-style-type: none;
  padding: 0;
  margin: 0;
  margin-bottom: -1px;
}

.tab {
  font-family: $monospace;
  padding: 5px 10px;
  background: $color-lightest;
  width: fit-content;
  display: inline-block;
  border: 1px $color-lightest;
  border-radius: 2px;
  cursor: pointer;
}

.tab.active {
  background: $color-light;
  border-bottom-color: $color-light !important;
}

.tab-pane {
  width: 100%;

  position: relative;
  /* padding-left: 25px; */

  display: none;  
}

.tab-pane.active {
  display: block;
}

/* XXX: editor **************************************** */

.cm-editor {
  @include with-border;
  background-color: $color-bg;
  height: 100%;
  width: 100%;
}

.meta-container {
  display: none;
}